package com.yu.mall.controller;

import com.yu.mall.service.CaptchaService;
import com.yu.mall.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("captcha")
@Api(tags = "验证码管理",value = "验证码管理")
public class CaptchaController {

    @Autowired
    private CaptchaService captchaService;

    @PostMapping("send")
    @ApiOperation(value = "发送验证码")
    @ApiImplicitParam(name = "phone",value="手机号",required=true)
    public ResultVO send(String phone){
        return captchaService.send(phone);
    }

    @PostMapping("list")
    @ApiOperation(value = "查询所有验证码")
    public ResultVO list(){
        return captchaService.list();
    }

}
